1. Building NML 🔗

You need at least the nightly version of rustc to compile NML. Instruction for your operating system can be found on Rust's website. You'll also need liblua 5.4 installed. You can then move the nml executable in target/release/nml into your $PATH

cargo build --bin nml or for release mode: cargo build --release --bin nml(Note: The release build binary is much smaller than the debug build one)

2. Building your first document 🔗

3. Using the cache 🔗

NML relies on sqlite to keep a cache of pre-compiled elements that take a long time to process (e.g ). To enable caching, use option -d with a path: -d cache.db. You can reuse the same cache for multiple documents and benefit from cached elements. Note that in directory-processing mode, a cache is required so that only modified .nml files get reprocessed.

Elements that will use the cache:

4. Directory-Processing mode 🔗

To use directory-processing mode, you need to pass an input directory and an output directory. Directory-processing mode requires that you use a database, so that it knows which documents have already been compiled. If the output directory doesn't exist, it will be automatically created.

Compiling the docs: nml -i docs -o docs_out -d cache.db

If you modify an @imported file, you will need to use the --force-rebuild option, as NML currently doesn't track which files are imported by other files.

5. Building the Language Server 🔗

NML comes with it's own language server, ready to be used in any LSP-compatible text editor, such as NeoVim.

Build it by using the following command: cargo build --bin nmlls or for release mode: cargo build --release --bin nmlls(Note: The release build binary is much smaller than the debug build one)

You should move the language server somewhere in your $PATH.

Integrating the LSP 🔗

Below is a list of integration steps the language server in various editors.

NeoVim 🔗

The first step is to add the .nml extension to NeoVim, so it is recognized:

vim.filetype.add({
	pattern = {
		['.*%.nml'] = 'nml',
	},
})

Then you need to register the language server in NeoVim. I recommend the lsp-zero plugin for that purpose:

{
	"VonHeikemen/lsp-zero.nvim",
	config = function()
		local lsp_zero = require('lsp-zero')

		lsp_zero.on_attach(function(client, bufnr)
			lsp_zero.default_keymaps({buffer = bufnr})
		end)

		lsp_zero.new_client({
			name = 'nmlls',
			cmd = {'<PATH TO BINARY IF NOT IN $PATH/>nmlls'},
			filetypes = {'nml'},
		})
	end,
}